using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using ComponentFactory.Krypton.Toolkit;
using Taurus.Platform.DTO;

namespace Taurus
{
    public partial class AccountDialog : ComponentFactory.Krypton.Toolkit.KryptonForm
    {
        public UserAccount UserAccount { get; set; }

        public AccountDialog(UserAccount ua)
        {
            InitializeComponent();
            UserAccount = ua;
            if (UserAccount!=null)
            {
                txtName.Text = UserAccount.Name;
                txtPassword.Text = UserAccount.Password;
                txtEmail.Text = UserAccount.Email;
                cbxPublic.Checked = UserAccount.IsPublic;
            }
        }

        public void SetSubmitButtonText(string value)
        {
            btnSubmit.Text = value;
        }

        private void btnSubmit_Click(object sender, EventArgs e)
        {
            UserAccount = UserAccount ?? new UserAccount();
            UserAccount.Name = txtName.Text;
            UserAccount.Password = txtPassword.Text;
            UserAccount.Email = txtEmail.Text;
            UserAccount.IsPublic = cbxPublic.Checked;
        }
    }
}